/******************************************************************************
 * * inter_setting_interface.h - internal interface between setting and others
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef INTER_SETTING_INTERFACE_H
#define INTER_SETTING_INTERFACE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "ui_ringtone.h"

#define SETTING_MAX_SIM_NAME_LEN    20
typedef VOID Setting_Wall_Paper_t;

typedef enum
{
    SETTING_ERROR = 0,                         // PIN check fail
    SETTING_OK,                                // PIN check success
    SETTING_BACK                               // BACK, security code not checked
} SETTING_RESULT;

typedef enum
{
    IF_SETTING_DUAL_SIM_STANDBY = 0,
    IF_SETTING_SIM_1_STANDBY,
    IF_SETTING_SIM_2_STANDBY
} IF_SETTING_DUAL_STANDBY_STATUS;

typedef enum
{
    IF_SETTING_ASK_EVERY_TIME = 0,
    IF_SETTING_DEFAULT_SIM_1,
    IF_SETTING_DEFAULT_SIM_2
} IF_SETTING_DEFAULT_SIM;

typedef enum
{
    IF_SETTING_PLAY_TONS_STOP = 0,
    IF_SETTING_PLAY_TONS_START
} IF_SETTING_PLAY_TONE_CTRL;
typedef enum
{
    IF_SETTING_SERVICE_CALL = 0,
    IF_SETTING_SERVICE_SMS
} IF_SETTING_SERVICE_TYPE;

typedef enum
{
    IF_SETTING_TONS_TYPE_CALL = 0,
    IF_SETTING_TONS_TYPE_SMS,
    IF_SETTING_TONS_TYPE_KEYPAD,
    IF_SETTING_TONS_TYPE_WARNING,
    IF_SETTING_TONS_TYPE_ALARM,
    IF_SETTING_TONS_TYPE_CALENDAR,
    IF_SETTING_TONS_TYPE_CONTACTS,
    IF_SETTING_TONS_TYPE_AUDIO_PLAYER,
    IF_SETTING_TONE_TYPE_SYSTEM             // for power on/off
} IF_SETTING_TONE_TYPE;

typedef struct
{
    MMI_MODEM_SIM_ID          SimId;
    IF_SETTING_PLAY_TONE_CTRL PlayCtrl;
    IF_SETTING_TONE_TYPE      ToneType;

#define IF_SETTING_INVALID_TONE    0xFF
    UINT8                     SpecToneIndex;              // spec tone in contact or alarm
} If_Setting_Play_Tone_t;

typedef enum
{
    IF_SETTING_TIME_HIDE = 0,                              // hide time on desktop
    IF_SETTING_TIME_SHOW,                                  // show time on desktop
} IF_SETTING_TIME_DISPLAY;

typedef enum
{
    IF_SETTING_TIME_FORMAT_12H = 0,                        // 12 hours format
    IF_SETTING_TIME_FORMAT_24H,                            // 24 hours format
} IF_SETTING_TIME_FORMAT;

typedef struct
{
    IF_SETTING_TIME_DISPLAY TimeDisplay;
    IF_SETTING_TIME_FORMAT  TimeFormat;
} If_Setting_Time_Display_t;

typedef struct
{
    UINT8 RingNameCnt;

#define IF_SETTING_MAX_NAME_LEN    10
    INT8  RingName[IF_SETTING_MAX_NAME_LEN];
} If_Setting_Tone_List_t;

typedef enum
{
    IF_SETTING_STANDBY_SCREEN_OFF = 0,                       // standby screen off
    IF_SETTING_STANDBY_SCREEN_ON,                            // standby screen on
    // IF_SETTING_STANDBY_SCREEN_1_HOUR                         // standby screen timeout 1 hour
} IF_SETTING_STANDBY_SCREEN;

/*
 * typedef enum
 * {
 *
 #define SETTING_MAX_WALL_PAPER_NUM    2                                         // support only 2 wall papers
 * typedef struct
 * {
 * UINT16       WallpaperNameID;
 * lv_img_dsc_t WallPaper;
 * } Setting_Display_Wall_Paper_t;
 *
 * typedef struct
 * {
 * UINT8                       CurrentWallPaperIndex;                        // current wall paper index
 * SETTING_BACKLIGHT_INTENSITY BacklightIntensity;                           // backlight intensity level
 * SETTING_BACKLIGHT_TIMEOUT   BacklightTimeout;                             // backlight timeout value
 *
 *
 */
typedef enum
{
    IF_SETTING_CHANGE_MARK_DUAL_STAND_BY       = 0x0001,
    IF_SETTING_CHANGE_MARK_NAME_OF_SIM1        = 0x0002,
    IF_SETTING_CHANGE_MARK_NAME_OF_SIM2        = 0x0004,
    IF_SETTING_CHANGE_MARK_WALL_PAPER          = 0x0008,
    IF_SETTING_CHANGE_MARK_TIME_DISPLAY        = 0x0010,
    IF_SETTING_CHANGE_MARK_CURRENT_LANGUAGE    = 0x0020,
    IF_SETTING_CHANGE_MARK_AUTO_GUARD_ON       = 0x0040,
    IF_SETTING_CHANGE_MARK_AUTO_GUARD_DELAY    = 0x0080,
    IF_SETTING_CHANGE_MARK_KEYGUARD_ON         = 0x0100,
    IF_SETTING_CHANGE_MARK_STARTUP_TONE_ON     = 0x0200,
    IF_SETTING_CHANGE_MARK_WELCOME_NOTE_ON     = 0x0400,
    IF_SETTING_CHANGE_MARK_WELCOME_NOTE        = 0x0800,
    IF_SETTING_CHANGE_MARK_STANDBY_SCREEN_MODE = 0x1000,
    IF_SETTING_CHANGE_MARK_FLIGHT_MODE_ON      = 0x2000
} IF_SETTING_CHAGNE_MARK;

typedef enum
{
    SETTING_LANGUAGE_EN = 0,                                                    // english
    SETTING_LANGUAGE_CN_SIMPLE,                                                 // simple chinese
    SETTING_LANGUAGE_CN_TRADITIONAL                                             // traditional chinese
} SETTING_LANGUAGE;

typedef struct
{
    UINT16                         ChangeMark;                                   // changed mark
    IF_SETTING_DUAL_STANDBY_STATUS DualStandby;                                  // setting of dual standby
    UINT8                          NameOfSIM1[SETTING_MAX_SIM_NAME_LEN];         // name of SIM1
    UINT8                          NameOfSIM2[SETTING_MAX_SIM_NAME_LEN];         // name of SIM2
    Setting_Wall_Paper_t           *WallPaper;                                   // wall paper pointer
    If_Setting_Time_Display_t      TimeDisplay;                                  // time display setting
    SETTING_LANGUAGE               CurrentLanguage;                              // current language setting
    BOOL                           AutoGuardOn;                                  // true means auto guard on.
    UINT16                         AutoGuardDelay;                               // delay in second for auto guard starting.
    BOOL                           KeyguardOn;                                   // true means keyguard on.
    BOOL                           StartupToneOn;                                // true means start-up tone on.
    BOOL                           WelcomeNoteOn;                                // true means welcome note will be displayed
#define IF_SETTING_MAX_WELCOME_NOTE_LEN    (20 * 3 + 1)                          // equal to NV_SETTING_MAX_WELCOME_NOTE_STR_LEN
    INT8                           WelcomeNote[IF_SETTING_MAX_WELCOME_NOTE_LEN]; // Max length of welcome note
    IF_SETTING_STANDBY_SCREEN      StandbyScreenMode;                            // screen standby mode
    BOOL                           FlightModeOn;                                 // true means flight mode on.
} Setting_Phone_Setting_t;

/**
 * initiate setting module
 * param (in) void
 * return  void
 */
extern VOID Setting_Init_Req(VOID);        // to init all setting module

/**
 * initiate confirm
 * param (in) void
 * return  void
 */
extern VOID Setting_Init_Cnf(Setting_Phone_Setting_t *PhoneSetting);        // to confirm init

/**
 * to indicate that the phone setting has been restore
 * param (in) void
 * return  void
 */
extern VOID Setting_Phone_Setting_Restore_Ind(Setting_Phone_Setting_t *PhoneSetting);

/**
 * get dual standby status
 * param (in) void
 * return  UINT8: IF_SETTING_DUAL_STANDBY_STATUS
 */
extern UINT8 Setting_Get_Dual_Standby_Req(VOID);

/**
 * response of Setting_Dual_Standby_Change_Ind
 * param (in) void
 * return  void
 */
extern VOID Setting_Dual_Standby_Change_Resp(VOID);

/**
 * get sim name
 * param (in) SimId: MMI_MODEM_SIM_ID
 * return  UIN8*
 */
extern INT8 *Setting_Get_Sim_Name_Req(MMI_MODEM_SIM_ID SimId);

/**
 * get dual standby status
 * param (in) ServiceType: IF_SETTING_SERVICE_TYPE
 * return  UINT8: IF_SETTING_DEFAULT_SIM
 */
extern IF_SETTING_DEFAULT_SIM Setting_Get_Default_Sim_Req(IF_SETTING_SERVICE_TYPE ServiceType);

/**
 * to get tone list for contact spec tone
 * param (in) void
 * return  If_Setting_Tone_List_t*: list of ring name
 */
extern If_Setting_Tone_List_t *Setting_Get_Tone_List_Req(VOID);

/**
 * indicate whether silent profile is selected, true means silent
 * param (in) Silent: BOOL(ture/false)
 * return  void
 */
extern VOID Setting_Ring_Silent_Ind(BOOL Silent);

/**
 * Play tone for power on/off
 * param (in) Cb: CB_FUNC
 * return  void
 */
extern VOID Setting_Play_System_Tone_Req(CB_FUNC Cb);

/**
 * ask tone setting module to play tone/vibrating
 * param (in) simId: MMI_MODEM_SIM_ID
 * return  void
 */
extern VOID Setting_Play_Tone_Req(If_Setting_Play_Tone_t *SettingPlayTone);

/**
 * to set ring volume
 * param (in) RingVolume: HAL_SPEAKER_GAIN
 * return  void
 */
extern VOID Setting_Set_Ring_Volume_Req(HAL_SPEAKER_GAIN RingVolume);

/**
 * to get ring volume
 * param (in) void
 * return  UINT8: HAL_SPEAKER_GAIN
 */
extern UINT8 Setting_Get_Ring_Volume_Req(VOID);

/**
 * get current wall paper
 * param (in) WallPaper: lv_img_dsc_t*
 * return  void
 */
extern VOID Setting_Get_Wall_Paper_Req(Setting_Wall_Paper_t **WallPaper);

/**
 * get time display mode
 * param (out) TimeDisplay: If_Setting_Time_Display_t
 * return  void
 */
extern VOID Setting_Get_Time_Display_Req(If_Setting_Time_Display_t *TimeDisplay);

/**
 * indicate framework that RTC has been re-configurated
 * param (in) VOID
 * return  void
 */
extern VOID Setting_RTC_Reconfig_Ind(VOID);

/**
 * to PIN code check confirm
 * param (in) SimId: MMI_MODEM_SIM_ID
 * param (in) Result: SETTING_RESULT
 * return  void
 */
typedef VOID (*Setting_Check_PIN_Cnf_t)(MMI_MODEM_SIM_ID SimId, SETTING_RESULT Result);

/**
 * to check PIN code
 * param (in) SimId: MMI_MODEM_SIM_ID
 * return  void
 */
extern VOID Setting_Check_PIN_Req(MMI_MODEM_SIM_ID SimId, Setting_Check_PIN_Cnf_t CheckPinCnf);

/**
 * to security code check confirm
 * param (in) result: SETTING_RESULT
 * return  void
 */
typedef VOID (*Setting_Check_Security_Cnf_t)(SETTING_RESULT Result);

/**
 * to check ecurity key guard code
 * param (in) void
 * return  void
 */
extern VOID Setting_Check_Security_Keyguard_Req(Setting_Check_Security_Cnf_t CheckSecurityCnf);

/**
 * to check Security code
 * param (in) void
 * return  void
 */
extern VOID Setting_Check_Security_Req(Setting_Check_Security_Cnf_t CheckSecurityCnf);

/**
 * get phone setting
 * param (out) PhoneSetting: If_Setting_Phone_Setting_t, alloc and free by caller
 * return  void
 */
extern VOID Setting_Get_Phone_Setting_Req(Setting_Phone_Setting_t *PhoneSetting);

/**
 * phone setting change indication
 * param (in) PhoneSetting: If_Setting_Phone_Setting_t, alloc and free by caller
 * return  void
 */
extern VOID Setting_Phone_Setting_Chg_Ind(Setting_Phone_Setting_t *PhoneSetting);

/**
 * Get redial on/off configuration
 * param (in) void
 * return  BOOL: true means redial on.
 */
extern BOOL Setting_Get_Redial_config_Req(VOID);

/**
 * Set sim status by framework
 * param (in) simId: MMI_MODEM_SIM_ID
 * param (in) simStatus: BOOL
 * return  void
 */
extern VOID Setting_Set_Sim_Status(MMI_MODEM_SIM_ID simId, BOOL simStatus);

/**
 * LCD wakeup or sleep
 * param (in) Wakeup: BOOL
 * return VOID:
 */
extern VOID Setting_Set_Lcd_Status(BOOL Wakeup);

/**
 * Get LCD status
 * param (in) Wakeup: BOOL
 * return VOID:
 */
extern BOOL Setting_Get_Lcd_Status(VOID);

/**
 * Get backlight Timer length
 * param (in) VOID
 * return UINT32: in second
 */
extern UINT32 Setting_Get_Backlight_Timer_Length(VOID);

/**
 * Inform setting that power on tone play end
 * param (in) VOID
 * return VOID
 */
extern VOID Setting_Power_On_Tone_End_Ind(VOID);

/**
 * Inform alarm and calendar that the time is changed
 * param (in) VOID
 * return VOID
 */
extern VOID Setting_Time_Change_Ind(VOID);

#if USE_LV_WLAN != 0
/**
 * initiate WLAN sub-module
 * param (in) VOID
 * return  VOID
 */
extern VOID Setting_Wlan_Init(VOID);
#endif

#ifdef __cplusplus
}
#endif

#endif /*INTER_SETTING_INTERFACE_H*/
